package com.ikangtai.shecare.common.baseView.recordButtonView;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.View;

import com.ikangtai.shecare.R;

/**
 * Created by Administrator on 2016/1/20.
 */
public class RecordOptionBBTButton extends RecordOptionButton implements View.OnClickListener{

    private Context context;
    public static final int RECORD_BBT_OPTION_WHITE_BACKGROUND_COLOR = 0;
    public static final int RECORD_BBT_OPTION_BLUE_BACKGROUND_COLOR = 1;
    public static final String RecordOptionBBTButtonType="BBT";
    public RecordOptionBBTButton(Context context){
        super(context);
        this.context=context;
    }
    public RecordOptionBBTButton(Context context, AttributeSet attrs){
        super(context,attrs);
        this.context=context;
        backgroundColor = RECORD_BBT_OPTION_WHITE_BACKGROUND_COLOR;
        setOnClickListener(this);
        setType(RecordOptionBBTButtonType);
    }

    @Override
    public void onClick(View v) {
       if(backgroundColor == RECORD_BBT_OPTION_WHITE_BACKGROUND_COLOR){
           this.setBackground(getResources().getDrawable(R.drawable.record_temperature_button_pressed));
           this.setTextColor(Color.WHITE);
           backgroundColor = RECORD_BBT_OPTION_BLUE_BACKGROUND_COLOR;
       }else{
           this.setBackground(getResources().getDrawable(R.drawable.record_temperature_button_default));
           this.setTextColor(getResources().getColor(R.color.lpq_color));
           backgroundColor = RECORD_BBT_OPTION_WHITE_BACKGROUND_COLOR;
       }

    }

    @Override
    public void setBackgroundColor(int backGroundColor) {
        super.setBackgroundColor(backGroundColor);
        if(backGroundColor == RECORD_BBT_OPTION_WHITE_BACKGROUND_COLOR){
            this.setBackground(getResources().getDrawable(R.drawable.record_temperature_button_default));
            this.setTextColor(getResources().getColor(R.color.lpq_color));
        }else{
            this.setBackground(getResources().getDrawable(R.drawable.record_temperature_button_pressed));
            this.setTextColor(Color.WHITE);
        }
    }


}
